package com.gitee.feizns.zxw.web.controller.api;

import com.gitee.feizns.web.domain.page.PageAo;
import com.gitee.feizns.web.domain.page.PageVoRet;
import com.gitee.feizns.web.domain.result.Ret;
import com.gitee.feizns.web.mvc.validate.annotation.Exists;
import com.gitee.feizns.zxw.domain.pojo.DestinationAttractions;
import com.gitee.feizns.zxw.domain.portal.ao.destination.attractions.ListAo;
import com.gitee.feizns.zxw.domain.portal.vo.destination.attractions.DetailsVo;
import com.gitee.feizns.zxw.domain.portal.vo.destination.attractions.ListVo;
import com.gitee.feizns.zxw.service.api.ApiDestinationAttractionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 详情页 => 目的地 => 景区
 * @author feizns
 * @since 2019/9/10
 */
@Validated
@RestController
@RequestMapping("/api/v1/portal/destination/attractions")
public class ApiDestinationAttractionsController {

    @Autowired
    private ApiDestinationAttractionsService apiDestinationAttractionsService;

    /**
     * 具体景区的详情
     * @param id
     * @return com.gitee.feizns.zxw.domain.portal.vo.destination.attractions.DetailsVo
     */
    @GetMapping("/{id}")
    public Ret<DetailsVo> details(@PathVariable @Exists(DestinationAttractions.class) Integer id) {
        return Ret.ok(apiDestinationAttractionsService.details(id));
    }

    /**
     * 景区列表
     * @param page
     * @param ao
     * @return com.gitee.feizns.zxw.domain.portal.vo.destination.attractions.ListVo
     */
    @GetMapping
    public Ret<PageVoRet<ListVo>> list(PageAo page, ListAo ao) {
        return Ret.ok(apiDestinationAttractionsService.list(page, ao));
    }

}
